#include<iostream>
#include<vector>
#include<string>
#include<fstream>

using namespace std;

struct ListNode {
    int val;
    ListNode* next;
    ListNode(int x) : val(x), next(NULL) {}
};

ListNode* detectCycle(ListNode* head) {
    auto slow = head, fast = head;
    while (fast != nullptr && fast->next != nullptr)
    {
        slow = slow->next;
        fast = fast->next->next;
        if (slow == fast)
        {
            slow = head;
            while (slow != fast)
            {
                slow = slow->next;
                fast = fast->next;
            }
            return slow;
        }
    }
    return nullptr;
}

int main()
{
    ifstream ifs("text.txt");
    if (!ifs.is_open())
    {
        cout << "open file fail" << endl;
        return 0;
    }
    srand(time(nullptr));
    auto t = rand();
    cout << t << endl;
    string s;
    getline(ifs, s);
    cout << s << endl;
    ifs.close();
    return 0;
}